<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#div1{
				width:100px;
				height:100px;
				background: blue;
			}
		</style>
	</head>
	<body>
		<script>
			
//			var re = confirm('确定删除么',true,false);
//			console.log(typeof re);
			window.onload = function(){
				var oA = document.getElementsByTagName('a')[0];
				var oDiv = document.getElementById("div1");
				oA.onclick = function(){
					var re = confirm('确认要变红色么',true,false);
					console.log(re);
					if(re){
						oDiv.style.background = 'red';
					}
					
				}
			}
			var i=0;
			for(attr in window){
				document.write(i+++'.'+attr+':'+window[attr]+'<br/>');
			}
	
		</script>
		<!--javascript:;写到href中可以阻止a标签的跳转行为-->
		<a href="javascript:;">变红色</a>
		<div id="div1"></div>
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	</body>
</html>
